import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JRadioButton;

public class ImpressionLogo extends JDialog implements ActionListener {

	private Logo logo;
	private JRadioButton Bimg, Bcode;
	private JButton BImprimer, BImprAnnuler;
	
	public ImpressionLogo(Logo logo) {
		this.logo = logo;
		
		this.setTitle("Choix impression");
		this.setLayout(new BorderLayout());
		Box box=Box.createHorizontalBox();
		
		Bcode = new JRadioButton("Imprimer le code courant");
		this.add(Bcode,BorderLayout.NORTH);
		
		Bimg = new JRadioButton("Imprimer l'image");		
		this.add(Bimg,BorderLayout.CENTER);
		
		BImprimer=new JButton("Imprimer");
		BImprimer.addActionListener(this);
		BImprAnnuler=new JButton("Annuler");
		BImprAnnuler.addActionListener(this);		
		box.add(BImprimer);
		box.add(BImprAnnuler);
		this.add(box,BorderLayout.SOUTH);		
		this.pack();

	}

	public void actionPerformed(ActionEvent e) {
		if(e.getSource()==BImprimer){
			if(Bcode.isSelected()){				
				logo.getConsol().sys("impression du code");
				logo.impression("code");		
			}
			if(Bimg.isSelected()){
				logo.getConsol().sys("impression de l'image");
				logo.impression("img");
			}						
		}
		this.setVisible(false);
	}

}
